﻿using Sustainalytics.SustainableProducts.Service.Infrastructure;
using Sustainalytics.Utils.Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace Sustainalytics.SustainableProducts.Service
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler((obj, exargs) => {

                CommonEventSerilog.Log.Exception((Exception)exargs.ExceptionObject);
            });

            if (Environment.UserInteractive)
            {
                // start as console app
                ProgramConsole.Start();
            }
            else
            {
                // start as windows service
                ProgramWindowsService.Start();
            }
        }
    }
}
